//引入字体图标
require('../lib/fonts/iconfont.css')

//渲染foot函数
function renderFoot(pathname) {
    //获取当前地址


    let arr = [{
            path: './home.html',
            title: '首页',
            icon: 'icon-shouye',
        },
        {
            path: './run.html',
            title: '运动',
            icon: 'icon-shouye1',
        },
        {
            path: './circle.html',
            title: '圈子',
            icon: 'icon-quanzi',
        },
        {
            path: './mine.html',
            title: '我的',
            icon: 'icon-wode',
        },
    ]
    let html = `
        ${arr
          .map((v) => {
            return `<a href="${v.path}" class="df fdc  ${
                v.path === `./${pathname}.html` && 'active'
              }"><span class="iconfont ${v.icon}"></span><span>${v.title}</span></a>`
          })
          .join('')}
    `
    
  //创建一个div
  let div = document.createElement('div')
  //设置div的class
  div.className = 'foot fn df jcsb wrap'
  //给div里面填充内容
  div.innerHTML = html
  //body把div添加进最后
  document.body.appendChild(div)
}

//导出tabbar渲染函数
module.exports = renderFoot